1. Field of the Invention
The invention relates to an image coding device and an image decoding device for compositing an object image with a background image through irreversible coding having a high compression rate, using a specific color of an image as a transmitting color.
2. Description of the Related Art
To meet the advancement of digital image processing techniques, image composition processing for compositing an input image from an image reading apparatus, such as a digital camera and a scanner, with another image to be used as a background image has been used increasingly in recent years. In a case of TV broadcasting and movies, a picture of an individual standing in front of a blue or green background is taken with a camera, then the color portion of the background in the pictured video is composited with a scene of a foreign country or the like through the use of a method called a chroma key, and a video as if the individual were in that country is thereby produced.
In the WWW browser of the Internet, an image of an outlined subject is also composited with a background image. In this case, the image composition is performed on the personal computer of the user. However, because an image to be placed on the foreground is sent from a remote server over the Internet, the image is compressed to save the transmission time. The outlined subject to be placed on the foreground is called an object and the surroundings of the object are filled with a specified transmitting color, so that the background will be visible only through the portion of the transmitting color that becomes transparent when the object and the background image are superimposed. GIF (Graphics Interchange Format) and PNG (Portable Network Graphics) are known as a standard image format that realizes the transmitting color in the above manner and comes with the WWW browser. Both of these compression methods adopt reversible compression by which an image will not change due to compression.
For a color facsimile machine, there is an optional coding method called MRC (Mixed Raster Content) that enables the image composition in the same manner as above. According to MRC, an image is divided into three layers: a fore layer, a mask layer, and a back layer, and each layer is encoded through different methods. The fore layer and the back layer are color images and the mask layer is a binary image, and which of the fore layer and the back layer is to be displayed is selected at the decoder's end.
Also, MPEG (Moving Picture Coding Experts Group)-4 used for encoding a moving image is furnished with an object-based coding function that enables the image composition in the same manner as above. According to the object-based coding, an image called an alpha plane is used separately besides an image containing an object to specify a transparent portion surrounding the object. The alpha plane includes a binary alpha plane of a binary image and a grayscale alpha plane. The grayscale alpha plane is used to specify translucence as an option, and irreversible coding is applied. The binary alpha plane is essential and reversible coding is applied.
FIG. 7 shows the original image 1 with a specified transmitting color 5, and FIG. 8 shows the decoded image 2 obtained through irreversibly coding. The reason why the related arts use the reversible coding for the image composition using a transmitting color as with GIF and PNG is as follows. That is, even when the transmitting color is specified, the pixel density is changed between a non-encoded original image 1 and a decoded image 2 in the case of irreversible coding, which causes noises particularly near the edge, and a portion other than the transmitting color portion is thereby produced in the surroundings of an object 4. Both in FIG. 7 and in FIG. 8, the gray portion represents the transmitting color. The reversible coding, however, has a problem that a compression rate is lower than that of the irreversible coding.
In order to use the irreversible coding while avoiding the occurrence of noises 6 in the surroundings of the object 4, a mask image is used separately besides the images to be composited as with the arbitrary shape coding in MRC and MPEG-4. Of a mask image 3 of FIG. 9, a white portion specifies the display of an object and a black portion specifies the display of a background. However, although a mask image is a binary image, it has to be reversibly encoded, which increases an overall coding quantity. Moreover, the need to composite images at the decoder's end using two or more coding methods not only complicates the device, but also demands a larger memory capacity, thereby posing a problem that the manufacturing costs are increased.
Further, in many cases of irreversible coding, an image is separated into a luminance component and two color-difference components before being encoded, and sub-sampling is performed on the color-difference components. This is because the human eyes are less sensitive to a change in color difference in comparison with a spatial change in luminance. Thus, in the case of a natural image, when an individual sees an image restored to the original resolution through up-sampling at the time of decoding, he hardly notices deterioration in image quality; moreover, it is almost impossible to identify a difference between an image restored from the data on which the sub-sampling was performed and an image restored from the data on which the sub-sampling was not performed. The occurrence of noises can be suppressed by lowering the compression rate even in the irreversible coding method. However, because the resolution is deteriorated when the sub-sampling is performed, lowering the compression rate is not suitable when displaying characters, the shape of an object, etc.